package com.zygh.interactiveplatform.module.service;

import cn.hutool.http.HttpUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.zygh.interactiveplatform.common.domain.ResponseDTO;
import com.zygh.interactiveplatform.module.mapper.TRFFAPPMapper;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Service
@DS("oracle")
public class TRFFAPPService {
    @Resource
    private TRFFAPPMapper trffappMapper;

    private static final String URL = "http://192.168.10.54:7100/big-data/count";

    /**
     * 查询车辆信息
     */
    public ResponseDTO findVehicle() {
        int driver = trffappMapper.findDrivinglicense();
        int vehicle = trffappMapper.findVehicle();
        Map<String, Object> map = new HashMap<>();
        map.put("vehicle",vehicle);
        map.put("driver",driver);
        return ResponseDTO.succData(map);
    }


    public Object vehicle(String startDate,String endDate){
        Map<String,Object> map = new HashMap<>();
        map.put("startDate",startDate);
        map.put("endDate",endDate);

        String s = HttpUtil.get(URL,map);
        System.out.println("《《《《《《《《《《《《《《《《"+s);
        //JSONObject jsonObject = JSONObject.fromObject(s);
        return s;
    }


}
